package com.yfbao.horizon.model;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import org.apache.catalina.mapper.Mapper;

/**
 * 三方UK认证信息dto
 */
@Data
public class UkAuthDto {

    //用户绑定的uk码
    private String ukCipher;

    //uk导出的证书信息
    private String certificate;

    //uk 签名计算后的数据
    private String signatureData;

    //认证服务url地址
    private String authUrl;

    //客户端IP地址
    private String ipAddress;

    //客户端IP地址
    private String appId;

    public static void main(String[] args) {

//        String aa ="{\"ukCipher\":\"xxx\",\"certificate\":\"xxx\",\"signatureData\":\"xxx\"}";
        deParse();
//        parse();
    }

    private static void deParse(){
       String aa= "{\"ukCipher\":\"BBTyFxMvqFjX7EQXVnxRwgElsZKBig==\",\"certificate\":\"MIIEgzCCBCegAwIBAgIIPfUAzQAzPYowDAYIKoEcz1UBg3UFADBpMQswCQYDVQQGEwJDTjE8MDoGA1UECgwzTmF0aW9uYWwgRS1Hb3Zlcm5tZW50IE5ldHdvcmsgQWRtaW5pc3RyYXRpb24gQ2VudGVyMRwwGgYDVQQDDBNDRUdOIFNNMiBDbGFzcyAyIENBMB4XDTI0MDMwMzE2MDAwMFoXDTI4MDMwMjE2MDAwMFowgakxCzAJBgNVBAYTAkNOMR4wHAYDVQQIDBXlub/opb/lo67ml4/oh6rmsrvljLoxJzAlBgNVBAoMHuiHquayu+WMuuS9j+aIv+WfjuS5oeW7uuiuvuWOhTEzMDEGA1UECwwq6Ieq5rK75Yy65L2P5oi/5ZKM5Z+O5Lmh5bu66K6+5L+h5oGv5Lit5b+DMRwwGgYDVQQDDBPnu5/kuIDmlK/mkpHlubPlj7AyMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE5DBPdHYIbcB+aOQkGV0FInxRUqLjP9r374Q8JczWgtPYBG+fJbLy5326excnWNJgZPHBYrmby3WY4HfBUBDMa6OCAnQwggJwMAwGA1UdEwQFMAMBAQAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGC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nV0aW9uUG9pbnQwgb8GCCsGAQUFBwEBBIGyMIGvMIGsBggrBgEFBQcwAoaBn2xkYXA6Ly9sZGFwLnN0YXRlY2EuY2Vnbi5jbjozODkvQ049Q0VHTiBTTTIgQ2xhc3MgMiBDQSxDTj1DRUdOIFNNMiBDbGFzcyAyIENBLCBPVT1jQUNlcnRpZmljYXRlcywgbz1zaWNjYT9jQUNlcnRpZmljYXRlP2Jhc2U/b2JqZWN0Q2xhc3M9Y2VydGlmaWNhdGlvbkF1dGhvcml0eTAdBgNVHQ4EFgQU8hcTL6hY1+xEF1Z8UcIBJbGSgYowDAYIKoEcz1UBg3UFAANIADBFAiBQ3FkuovO1rT/De20qjMvoCAVDbyybME/tx8EEMTps4wIhAN/gZtxq5BZIgbDt6dVurC6dz6u93gtSGaIlg20ZlfRMMYHfMIHcAgEBMHUwaTELMAkGA1UEBhMCQ04xPDA6BgNVBAoMM05hdGlvbmFsIEUtR292ZXJubWVudCBOZXR3b3JrIEFkbWluaXN0cmF0aW9uIENlbnRlcjEcMBoGA1UEAwwTQ0VHTiBTTTIgQ2xhc3MgMiBDQQIIPfUAzQAzPYowCgYIKoEcz1UBgxEwCgYIKoEcz1UBgi0ESDBGAiEA67a3X0M5G/VV+P9NY6bHU4UvBJfA/6FpwdB/KUacifQCIQCRDG7Rs4zbZxBEn4KorSXFVEcYEO7xKmnNnaEaDzKLvA==\"}";
        ObjectMapper mapper = new ObjectMapper();

        try {
            UkAuthDto ukAuthDto = mapper.readValue(aa, UkAuthDto.class);
            System.out.println(ukAuthDto);

            System.out.println("--------------------------\n");
            System.out.println(ukAuthDto.getUkCipher());
            System.out.println(ukAuthDto.getCertificate());
            System.out.println(ukAuthDto.getSignatureData());
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }

    private static void parse(){
        UkAuthDto ukAuthDto = new UkAuthDto();

        ukAuthDto.setUkCipher("xxx");
        ukAuthDto.setCertificate("xxx");
        ukAuthDto.setSignatureData("xxx");
        ObjectMapper mapper = new ObjectMapper();

        try {
            System.out.println(mapper.writeValueAsString(ukAuthDto));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }
}
